package com.lbfamous.regex;

import java.io.IOException;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.io.BufferedReader;
import java.io.FileReader;


public class ReaderIter {

    public static void main(String[] args) throws IOException {
        
        Pattern patt = Pattern.compile("[A-Za-z]+");

        BufferedReader r = new BufferedReader(new FileReader(args[0]));

        String line;
        while((line = r.readLine()) != null){

            Matcher m = patt.matcher(line);
            while(m.find()){
                System.out.println(m.group(0));

                int start = m.start(0);
                int end = m.end(0);
                System.out.println(line.substring(start,end));
            }
        }
    }    
}